package com.itheima.health.controller;


import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.PageResult;
import com.itheima.health.entity.QueryPageBean;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.CheckGroup;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.CheckGroupService;
import com.itheima.health.service.ChecksetmealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/setmeal")
@RestController
@Api(tags = "检查项组接口")
@Slf4j
public class ChecksetmealController {
        @Autowired
        private ChecksetmealService checksetmealService;

    /**
     * 检查项套餐分页查询
     * @return
     */
    @GetMapping("/findPage")
    public Result checkgroup(QueryPageBean queryPageBean){
        //TODO 调用service层
        PageResult pageResult = checksetmealService.getInquire(queryPageBean);

        return new Result(true,MessageConst.ACTION_SUCCESS,pageResult);
    }

    /**
     * 新增检查套餐
     * @return
     */
    @PostMapping("/add")
    public Result add(@RequestBody Setmeal setmeal,@RequestParam("checkgroupIds") List<Integer> checkgroupIds){
        //TODO 调用servic
        checksetmealService.newlySetmeal(setmeal,checkgroupIds);

        return new Result(true,MessageConst.ACTION_SUCCESS,null);
    }



}
